Vision systems that perform measurement, inspection, and/or alignment of objects and/or decoding of symbology in the form of machine-readable symbols (also termed “barcodes”, “ID codes”, “codes” and/or simply, “IDs”). Often, these machine-readable symbols take the form of well-known 1-dimensional (1D) and two-dimensional (2D) barcodes, such as a 2D DataMatrix codes, QR codes, DPM codes, etc. More generally, a barcode can be defined as an optical, machine-readable, representation of data; the data often describing something about the object that carries the barcode. Traditional barcodes systematically represent data by varying the widths and spacings of parallel lines, and may be referred to as linear or one-dimensional (1D). Later, two-dimensional (2D) variants were developed, using rectangles, dots, hexagons and other geometric patterns, called matrix codes or 2D barcodes, although they do not use bars as such, including, but not limited to DataMatrix codes, QR codes, and DPM codes, which are all used in a wide range of applications and industries. Barcode-reading systems are based generally around the use of an image sensor, which acquires images (typically grayscale or color, and in one, two or three dimensions) of the subject or object, and processes these acquired images using an on-board or interconnected vision system processor. The processor generally includes both processing hardware and non-transitory computer-readable program instructions that perform one or more vision system processes to generate a desired output based upon the image's processed information. This image information is typically provided within an array of image pixels each having various colors and/or intensities. In the example of a barcode reader (also termed herein, a “camera”), the user or automated process acquires an image of an object that is believed to contain one or more barcodes. The image is processed to identify barcode features, which are then decoded by a decoding process and/or processor obtain the inherent alphanumeric data represented by the code.
In operation, a barcode reader typically functions to illuminate the scene containing one or more barcodes. This illumination can include aimers that project a colored dot on the region of interest in the imaged scene, whereby the user can center the image axis of the reader on the barcode within the imaged scene. This illuminated scene is then acquired by an image sensor within the camera assembly through optics. The array sensor pixels is exposed, and the electronic value(s) generated for each pixel by the exposure is/are stored in an array of memory cells that can be termed the “image” of the scene. In the context of a barcode-reading application, the scene includes an object of interest that has one or more barcodes of appropriate dimensions and type. The barcode(s) are part of the stored image.
A common use for barcode readers is to track and sort objects moving along a line (e.g. a conveyor) in manufacturing and logistics operations. The barcode reader, or more typically, a plurality (constellation) of readers, can be positioned over the line at an appropriate viewing angle(s) to acquire any expected barcodes on the face(s) of respective objects as they each move through the field of view. The focal distance of the reader with respect to the object can vary, depending on the placement of the reader with respect to the line and the size of the object. As such, the use of an auto-focus mechanism in association with the barcode reader is desirable to attain the proper focal distance.
Existing techniques for providing auto-focus functionality to barcode readers entail sweeping through a potentially large number of focus settings, and choosing the setting which maximizes image sharpness for a selected region of interest. A procedure for auto-focus is described, by way of useful background information in Daniel Vaquero, Natasha Gelfand, Marius Ticol, Kari Pullil and Matthew Turk, Generalized Autofocus, Applications of Computer Vision (WACV), 2011 IEEE.
The region of interest is often selected using heuristic contrast measurements, which often mistake other high-contrast structures (e.g. text or other graphics) for barcodes. Both the contrast measurements and the sharpness metrics are only meaningful when the focus is nearly correct, which is why a large number of focus settings need to be considered during the sweep. Moreover, the sharpness metrics are sensitive to lighting, which is something that might also vary (e.g. during the course of an auto-regulation operation, where the lighting is also being optimized). Such methods are, therefore, time-consuming, and can result in focusing on the wrong area of the scene. Additionally, commercially available techniques for locating barcodes have operated too slowly to employ directly during an auto-focusing process loop. In general, focus on a region is first established, and then the barcode finding and decoding procedures operate upon a focused image of the region of interest.